package com.edu.demo.excel;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @ClassName EasyExcellistener
 * @date 2022/9/15 15:02
 * @Version 1.0
 */
public class EasyExcellistener extends AnalysisEventListener<DemonData> {
    //创建list集合封装最终的数据
    List<DemonData> list = new ArrayList<DemonData>();
    //一行一行去读取excle内容
    @Override
    public void invoke(DemonData user, AnalysisContext analysisContext) {
        System.out.println("***"+user);
        list.add(user);
    }
    //读取excel表头信息
    @Override
    public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
        System.out.println("表头信息："+headMap);
    }
    //读取完成后执行
    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
    }
}
